package com.yuanfeng.commoms.constant;

import com.yuanfeng.commoms.util.StringUtils;

import java.util.Arrays;
import java.util.Optional;

public interface CommonType {

    /**
     * 通用状态
     */
    enum commonStatus {
        NO(0, "否"),
        YES(1, "是"),
        OTHER(2, "其他");


        commonStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private Integer code;
        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<commonStatus> op = Arrays.stream(commonStatus.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<commonStatus> op = Arrays.stream(commonStatus.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 通用状态
     */
    enum commonState {
        NO(1, "否"),
        YES(2, "是");

        private Integer code;
        private String desc;

        commonState(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<commonStatus> op = Arrays.stream(commonStatus.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<commonStatus> op = Arrays.stream(commonStatus.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 状态值
     */
    enum configEnable {
        NOT_AVAILABLE(0, "不可用"),
        AVAILABLE(1, "可用");


        configEnable(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private Integer code;
        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<configEnable> op = Arrays.stream(configEnable.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<configEnable> op = Arrays.stream(configEnable.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }


    enum pointsLogType {
        GAIN(1, "获取积分"),
        CONSUME(2, "积分消费");


        pointsLogType(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private Integer code;
        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<pointsLogType> op = Arrays.stream(pointsLogType.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<pointsLogType> op = Arrays.stream(pointsLogType.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    enum pointType {
        REGISTRATION(1, "会员注册"),
        LOGIN(2, "会员登录"),
        APPRAISE(3, "评价"),
        PURCHASE(4, "购买商品"),
        ADMIN(5, "管理员操作"),
        POINTS_EXCHANGE_GOODS(6,"积分换购商品"),
        POINTS_EXCHANGE_VOUCHER(7,"积分兑换代金券"),
        RETURN_OF_GOODS(8,"退货"),
        PlUS_REMOVE_OBSTACLES(9,"开通plus会员");

        pointType(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private Integer code;
        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<pointType> op = Arrays.stream(pointType.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<pointType> op = Arrays.stream(pointType.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    enum storeStatus {
        SUCCESSFULLY(3, "开店成功"),
        REVIEWED_PAYMENT(2, "待审核付款"),
        REVIEWED_DATA(1, "待审核资料"),
        CLOSE(0,"关闭");

        storeStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private Integer code;
        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<storeStatus> op = Arrays.stream(storeStatus.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<storeStatus> op = Arrays.stream(storeStatus.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    enum storeType {
        SELLER_STORE(1, "卖家店铺"),
        SUPPLIER_STORE(2, "供应商店铺");


        storeType(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private Integer code;
        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<storeType> op = Arrays.stream(storeType.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<storeType> op = Arrays.stream(storeType.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    enum isApproved {
        TO_BE_REVIEWED(0, "待审核"),
        APPROVED(1,"审核通过"),
        FAILED_TO_REVIEW(2, "审核不通过");


        isApproved(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private Integer code;
        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<isApproved> op = Arrays.stream(isApproved.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<isApproved> op = Arrays.stream(isApproved.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    //启用和禁用状态
    enum smsEnableDisableStatus {
        FORBIDDEN(0, "禁用"),
        STARTUSING(1,"启用");


        smsEnableDisableStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private Integer code;
        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<smsEnableDisableStatus> op = Arrays.stream(smsEnableDisableStatus.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<smsEnableDisableStatus> op = Arrays.stream(smsEnableDisableStatus.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    //伪删除标识
    enum pseudoDeleteIdentification {
        DELETE(0, "禁用"),
        NORMAL(1,"启用");


        pseudoDeleteIdentification(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private Integer code;
        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<pseudoDeleteIdentification> op = Arrays.stream(pseudoDeleteIdentification.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<pseudoDeleteIdentification> op = Arrays.stream(pseudoDeleteIdentification.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    //初始化状态
    enum initializationStatus {
        SUCCESS(1, "初始化成功"),
        FAIL(2,"初始化失败");


        initializationStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private Integer code;
        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<initializationStatus> op = Arrays.stream(initializationStatus.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<initializationStatus> op = Arrays.stream(initializationStatus.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }


    //初始化状态
    enum uuidType {
        USER("U", "用户UUID");


        uuidType(String code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private String code;
        private String desc;

        public static String getByCode(String code) {
            if (code == null) {
                return null;
            }
            Optional<uuidType> op = Arrays.stream(uuidType.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static String getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<uuidType> op = Arrays.stream(uuidType.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    //启绑定类型
    enum bindType {
        SINAWEIBO(1, "sinaweibo"),
        QQ(2,"qq"),
        WEIXIN(3,"weixin"),
        ALIPAY(4,"支付宝"),
        EMAIL(5,"email"),
        MOBILE(6,"mobile");


        bindType(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private Integer code;
        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<bindType> op = Arrays.stream(bindType.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<bindType> op = Arrays.stream(bindType.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 账号店铺状态
     */
    enum shopBaseExist {
        NO_OPEN_STORE(0, "未开店"),
        OPEN_STORE(1, "开店成功"),
        SUB_ACCOUNT(2, "商家的子账号");


        private Integer code;
        private String desc;

        shopBaseExist(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<shopBaseExist> op = Arrays.stream(shopBaseExist.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<shopBaseExist> op = Arrays.stream(shopBaseExist.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 商家入驻店铺支付凭证状态 0-待商家上传付款凭证;1-待审核付款凭证;2-审核不通过；3-审核通过
     */
    enum JoinPayStatus {
        WAIT_UPLOAD(0, "待商家上传付款凭证"),
        WAIT_AUDIT(1, "待审核付款凭证"),
        AUDIT_ERROR(2, "审核不通过"),
        AUDIT_SUCCESS(3, "审核通过");


        private Integer code;
        private String desc;

        JoinPayStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<JoinPayStatus> op = Arrays.stream(JoinPayStatus.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<JoinPayStatus> op = Arrays.stream(JoinPayStatus.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 店铺类型
     */
    enum ShopType {
        COMMON_SHOP(1, "普通店铺"),
        SUPPLY_SHOP(2, "供应商"),
        BRAND_SHOP(3, "品牌店铺");


        private Integer code;
        private String desc;

        ShopType(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<ShopType> op = Arrays.stream(ShopType.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<ShopType> op = Arrays.stream(ShopType.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 店铺入驻类型
     */
    enum JoinType {
        PERSONAL_SHOP(0, "个人入驻"),
        BUSINESS_SHOP(1, "企业入驻"),
        SUPPLY_SHOP(2, "供应商入驻");


        private Integer code;
        private String desc;

        JoinType(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<JoinType> op = Arrays.stream(JoinType.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<JoinType> op = Arrays.stream(JoinType.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 审核状态 1-正常；2-待审核；3-审核不通过
     */
    enum auditVerify {
        AUDIT_SUCCESS(1, "正常"),
        AUDIT_WAIT(2, "待审核"),
        AUDIT_FAILED(3, "审核不通过");


        private Integer code;
        private String desc;

        auditVerify(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<auditVerify> op = Arrays.stream(auditVerify.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<auditVerify> op = Arrays.stream(auditVerify.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 审核状态 0:个人入驻 1:企业入驻 2:门店厂商 3:供应商
     */
    enum ShopBusiness {
        INDIVIDUAL(0, "个人入驻"),
        BUSINESS(1, "企业入驻"),
        STORE(2, "门店厂商"),
        SUPPLIER(3, "供应商");


        private Integer code;
        private String desc;

        ShopBusiness(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<ShopBusiness> op = Arrays.stream(ShopBusiness.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<ShopBusiness> op = Arrays.stream(ShopBusiness.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 审核 1待审核 2审核通过 3审核失败
     */
    enum VerifyStatus {
        NO_NEED(0, "不需要"),
        AUDIT_WAIT(1, "待审核"),
        AUDIT_SUCCESS(2, "审核通过"),
        AUDIT_FAILED(3, "审核失败");


        private Integer code;
        private String desc;

        VerifyStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<VerifyStatus> op = Arrays.stream(VerifyStatus.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<VerifyStatus> op = Arrays.stream(VerifyStatus.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 自定义类型
     */
    enum customStatus {
        HOT_COMMODITIES(5, "热销商品");


        private Integer code;
        private String desc;

        customStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<customStatus> op = Arrays.stream(customStatus.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<customStatus> op = Arrays.stream(customStatus.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    //网站初始化内容设置状态
    enum articleStatus {
        STARTUSING(1, "启用"),
        CLOSED(2,"关闭");


        articleStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private Integer code;
        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<articleStatus> op = Arrays.stream(articleStatus.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<articleStatus> op = Arrays.stream(articleStatus.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 自定义类型
     */
    enum indexConfig {
        COMMODITY(1, "商品"),
        SHOP(2, "店铺"),
        CLASSIFY(3, "分类");


        private Integer code;
        private String desc;

        indexConfig(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<indexConfig> op = Arrays.stream(indexConfig.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<indexConfig> op = Arrays.stream(indexConfig.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 员工权限
     */
    enum employeePermissions {
        PURCHASE_INQUIRY(1, "采购/询价"),
        ORGANIZATIONAL (2, "配置组织架构"),
        CONFIGURATION_PROCESS(3, "配置流程"),
        ACCOUNTING_PERIOD_MANAGEMENT(4, "账期管理"),
        POINTS_MALL(5, "积分商城");


        private Integer code;
        private String desc;

        employeePermissions(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<employeePermissions> op = Arrays.stream(employeePermissions.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<employeePermissions> op = Arrays.stream(employeePermissions.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 配置类型
     */
    enum configType {
        SEARCH(0, "search"),
        INDEX_SLIDER(1, "index_slider"),
        PC_INDEX_AD(2, "pc_index_ad"),
        SETTING(3, "setting"),
        LOGO_WRITING(4, "logo_copywriting"),
        SUPPLY_PC_INDEX_AD(2, "supply_pc_index_ad"),
        PLATFORM_OPERATION_SPECIFICATIONS(100, "platform_operation_specifications");

        configType(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private Integer code;
        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<configType> op = Arrays.stream(configType.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<configType> op = Arrays.stream(configType.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 配置键
     */
    enum configKey {
        SETTING_LOGO(0, "setting_logo"),
        SETTING_BUYER_LOGO(1, "setting_buyer_logo"),
        SETTING_SELLER_LOGO(2, "setting_seller_logo"),
        SHOP_DEFAULT_CONFIG(3, "shop_default_config"),
        SHOP_LOGO_WRITING(4, "logo_copywriting_ico_shop"),
        GOODS_LOGO_WRITING(4, "logo_copywriting_ico_goods"),
        PLATFROM_SETTING(5, "setting"),
        PLATFROM_SEARCH_SETTING(6, "search"),
        PLATFROM_PHOTO_SETTING(7, "photo"),
        WEB_ME_PAGE_ADVERTISING(8, "web_me_page_advertising"),
        THEME_UNI_COLOR(9, "uni_color"),
        THEME_WEB_COLOR(10, "theme_web_color"),
        PC_INDEX_SLIDER(11, "index_slider"),
        FOOD_SLIDER_PC(12, "foodSliderPC"),
        JOIN_SETTING(13, "join_setting"),
        BUSIBESS_SWITCH(13, "business_switch"),
        PASSWORD_FORMAT(13, "password_format"),
        PASSWORD_LENGTH(13, "password_length"),
        ITEGRAL_IMAGE(13, "integral_image"),
        WEB_COLOR(15, "web_color"),
        OTHER(99, "other"),
        RETENTION_MONEY_DEFAULT_LIMIT(100,"retention_money_default_limit");



        configKey(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private Integer code;
        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<configKey> op = Arrays.stream(configKey.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<configKey> op = Arrays.stream(configKey.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 配置键
     */
    enum loginPlatform {
        PC_LOGIN(1, "PC登录"),
        BOSS_LOGIN(2, "后台登录"),
        BUSINESS_LOGIN(3, "商家登录"),
        SUPPLIER_LOGIN(4, "供应商登录");


        loginPlatform(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private Integer code;
        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<loginPlatform> op = Arrays.stream(loginPlatform.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<loginPlatform> op = Arrays.stream(loginPlatform.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * Boolean状态值
     */
    enum booleanStatus {
        FALSE(0, "false"),
        TRUE(1, "true");

        private Integer code;
        private String desc;

        booleanStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<booleanStatus> op = Arrays.stream(booleanStatus.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<booleanStatus> op = Arrays.stream(booleanStatus.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 店铺状态-3：开店成功 2:待审核付款 1:待审核资料 0:关闭
     */
    enum shopStatus {
        STORE_CLOSED(0, "店铺关闭"),
        STORE_WAIT_JOIN_BASE(1, "待审核资料"),
        STORE_WAIT_JOIN_PAY(2, "待审核付款"),
        STORE_OPEN_SUCCESS(3, "开店成功");

        private Integer code;
        private String desc;

        shopStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<shopStatus> op = Arrays.stream(shopStatus.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<shopStatus> op = Arrays.stream(shopStatus.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 经销申请状态
     */
    enum dealerStatus {
        WAIT_AUTH(1,"待审核"),
        AUTH_PASS(2,"审核通过"),
        AUTH_REFUSE(3,"审核不通过"),
        DEALER_DEL(4,"已删除");


        private Integer code;
        private String desc;

        dealerStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<dealerStatus> op = Arrays.stream(dealerStatus.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<dealerStatus> op = Arrays.stream(dealerStatus.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    enum dealerType {
        PUT_AWAY(1,"一键上架"),
        BUY(2,"立即购买");


        private Integer code;
        private String desc;

        dealerType(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<dealerType> op = Arrays.stream(dealerType.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<dealerType> op = Arrays.stream(dealerType.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     *商品一键上架记录状态
     */
    enum putawayState {
        NORMAL(1,"正常"),
        CANCEL(2,"取消");


        private Integer code;
        private String desc;

        putawayState(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<putawayState> op = Arrays.stream(putawayState.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<putawayState> op = Arrays.stream(putawayState.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }



    /**
     * spu商品状态 0下架，1正常，10违规（禁售）,2-店铺下架商品下架
     *          商品锁定 （）
     *          商品屏蔽 （1 不屏蔽 2 屏蔽）
     */
    enum commonSpuState {
        GOODS_OFF_SHELF(0, "商品下架"),
        GOODS_NORMAL(1, "正常商品"),
        STORE_OFF_SHELF(2, "店铺下架商品下架"),
        GOODS_ILLEGAL(10, "违规（禁售）"),
        GOODS_NOT_LOCK(1, "不锁定"),
        GOODS_LOCK(2, "锁定"),
        GOODS_NOT_SHIELD(1, "不屏蔽"),
        GOODS_SHIELD(2, "屏蔽");

        private Integer code;
        private String desc;

        commonSpuState(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<commonSpuState> op = Arrays.stream(commonSpuState.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<commonSpuState> op = Arrays.stream(commonSpuState.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 商品上下架状态 1-上架 2-下架 0-关闭店铺手动下架,3-店铺下架商品下架
     */
    enum goodsIsShelves {
        STORE_CLOSED(0, "关闭店铺手动下架"),
        GOODS_ON_THE_SHELF(1, "商品上架"),
        GOODS_OFF_THE_SHELF(2, "商品下架"),
        STORE_OFF_SHELF(3, "店铺下架商品下架");

        private Integer code;
        private String desc;

        goodsIsShelves(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<goodsIsShelves> op = Arrays.stream(goodsIsShelves.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<goodsIsShelves> op = Arrays.stream(goodsIsShelves.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 代金券模版状态(1-有效,2-失效)
     */
    enum voucherTState {
        EFFECTIVE(1, "有效"),
        LOSE_EFFICACY(2, "失效");

        private Integer code;
        private String desc;

        voucherTState(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<voucherTState> op = Arrays.stream(voucherTState.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<voucherTState> op = Arrays.stream(voucherTState.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 代金券状态(1-未用,2-已用,3-过期,4-收回)
     */
    enum voucherState {
        UNUSED(1, "未用"),
        USED(2, "已用"),
        OVERDUE(3, "过期"),
        TACK_BACK(4, "收回");

        private Integer code;

        voucherState(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<voucherState> op = Arrays.stream(voucherState.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<voucherState> op = Arrays.stream(voucherState.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 购物车状态
     */
    enum shoppingCartStatus {
        NORMAL(0, "正常"),
        DELETE(1, "删除"),
        UNDERCARRIAGE(2, "店铺关闭商品下架");


        shoppingCartStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private Integer code;
        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<shoppingCartStatus> op = Arrays.stream(shoppingCartStatus.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<shoppingCartStatus> op = Arrays.stream(shoppingCartStatus.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 商品状态
     */
    enum productStatus {
        UNDERCARRIAGE(0, "下架"),
        NORMAL(1, "正常"),
        VIOLATION(10,"违规(禁售)"),
        STORE_OFF_SHELF_GOODS_OFF_SHELF(2,"店铺下架商品下架"),
        DELETE(3,"删除");


        productStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private Integer code;
        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<productStatus> op = Arrays.stream(productStatus.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<productStatus> op = Arrays.stream(productStatus.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 商品审核
     */
    enum productReview {
        PASS(1,"通过"),
        FAILED(0, "不通过"),
        UNDER_REVIEW(10,"审核中");


        productReview(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private Integer code;
        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<productReview> op = Arrays.stream(productReview.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<productReview> op = Arrays.stream(productReview.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 秒杀商品状态
     *
     */

    enum seckillProductStatus {
        NORMAL(1,"正常"),
        FINISH(2, "结束"),
        ADMIN_SHUTDOWN(10,"管理员关闭");


        seckillProductStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private Integer code;
        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<seckillProductStatus> op = Arrays.stream(seckillProductStatus.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<seckillProductStatus> op = Arrays.stream(seckillProductStatus.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }


    /**
     * 商品是否参加促销0不参加,1砍价,2秒杀,3限时折扣,4拼团,5满减赠折
     *
     */

    enum promotionStatus {
        NOT_PARTICIPATING(0,"不参加"),
        BARGAIN(1, "砍价"),
        SECKILL(2,"秒杀"),
        DISCOUNT(3,"限时折扣"),
        COLLAGE(4,"拼团"),
        FULL_REDUCTION_AND_FREE_DISCOUNT(5,"满减赠折");


        promotionStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private Integer code;
        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<promotionStatus> op = Arrays.stream(promotionStatus.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<promotionStatus> op = Arrays.stream(promotionStatus.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 根据不同时间段查询 类型:1、全部，2、当日，3、本周，4、本月，5、年度
     *
     */

    enum timePeriod {
        TIME_ALL(1,"全部"),
        TIME_TODAY(2,"当天"),
        TIME_WEEK(3,"本周"),
        TIME_MONTH(4,"本月"),
        TIME_YEAR(5,"本年");

        timePeriod(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private Integer code;
        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<timePeriod> op = Arrays.stream(timePeriod.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<timePeriod> op = Arrays.stream(timePeriod.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 操作状态 0 正常 1 是添加  2是删除
     */
    enum operateStatus {
        NO_OPERATE(0, "正常"),
        ADD(1, "添加"),
        DEL(2, "删除");

        private Integer code;
        private String desc;

        operateStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<operateStatus> op = Arrays.stream(operateStatus.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<operateStatus> op = Arrays.stream(operateStatus.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 1：待审核（用户申请开启后数据库状态为1）
     * 2：正常（平台审核通过）
     * 3：待审核（用户申请关闭后数据库状态为3）
     * 4：审核失败（平台审核不通过）
     */
    enum deliveryApplyStatus {
        NOT_APPLIED(0, "未申请"),
        OPEN_TO_BE_REVIEWED(1, "开启待审核"),
        APPROVED(2, "开启审核通过"),
        OFF_TO_BE_REVIEWED(3, "关闭待审核"),
        OPEN_FAILED_TO_REVIEW(4, "开启审核不通过"),
        OFF_FAILED_TO_REVIEW(5, "关闭审核不通过");

        private Integer code;
        private String desc;

        deliveryApplyStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<deliveryApplyStatus> op = Arrays.stream(deliveryApplyStatus.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<deliveryApplyStatus> op = Arrays.stream(deliveryApplyStatus.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 订单删除状态
     *
     */

    enum orderDel {
        DELETE(1,"删除"),
        NOT_DELETE(0,"不删除");


        orderDel(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private Integer code;
        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<orderDel> op = Arrays.stream(orderDel.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<orderDel> op = Arrays.stream(orderDel.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 红包状态(1-未用,2-已用,3-过期)
     */
    enum redpacketState {
        UNUSED(1, "未用"),
        USED(2, "已用"),
        OVERDUE(3, "过期");

        private Integer code;

        redpacketState(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<redpacketState> op = Arrays.stream(redpacketState.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<redpacketState> op = Arrays.stream(redpacketState.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 红包类型，1-新人注册红包，2-普通红包，3-多品红包 4-店铺红包 5-多品新人红包 6-专属红包 默认2
     */
    enum redpacketTType {
        NEW_PERSON_REGISTRATION(1, "新人注册红包"),
        ORDINARY(2, "普通红包"),
        MULTIPLE_PRODUCTS(3, "多品红包"),
        SHOP(4, "店铺红包"),
        MULTI_PRODUCT_NEWCOMERS(5, "多品新人红包"),
        EXCLUSIVE(6, "专属红包"),
        PLUS_MEMBERSHIP(7, "plus会员");

        private Integer code;

        redpacketTType(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<redpacketTType> op = Arrays.stream(redpacketTType.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<redpacketTType> op = Arrays.stream(redpacketTType.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 订单状态
     *
     */

    enum orderStatus {
        TO_BE_PAID(1,"待支付"),
        PAID(2,"已付款"),
        TO_BE_SHIPPED(3,"待发货"),
        SHIPPED(4,"已发货"),
        SIGNED_FOR(5,"已签收"),
        CONFIRM_RECEIPT(6,"确认收货"),
        CANCEL(7,"取消"),
        REFUNDING(8,"退款中"),
        REFUNDED(9,"已退款"),
        PICKED_UP_BY_ONESELF(11,"待自提"),
        VIRTUAL_ORDER_HAS_EXPIRED(12,"虚拟订单已过期");


        orderStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private Integer code;
        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<orderStatus> op = Arrays.stream(orderStatus.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<orderStatus> op = Arrays.stream(orderStatus.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 退货状态
     *
     */

    enum orderReturnStatus {
        NO_RETURNS(0,"无退货"),
        RETURNING_GOODS(1,"退货中"),
        RETURN_COMPLETED(2,"退货完成"),
        RETURN_FAILED(3,"退货不通过");


        orderReturnStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private Integer code;
        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<orderReturnStatus> op = Arrays.stream(orderReturnStatus.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<orderReturnStatus> op = Arrays.stream(orderReturnStatus.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }


    /**
     * 退款状态
     *
     */

    enum orderRefundStatus {
        NO_REFUND(0,"无退款"),
        REFUNDING(1,"退款中"),
        REFUND_COMPLETED(2,"退款完成"),
        REFUND_FAILED(3,"退款不通过");


        orderRefundStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private Integer code;
        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<orderRefundStatus> op = Arrays.stream(orderRefundStatus.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<orderRefundStatus> op = Arrays.stream(orderRefundStatus.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 开票状态:0-未开票;1-审核中;2-已出票;3-未通过
     */
    enum invoiceStatus {
        NOT_INVOICE(0, "未开票"),
        WAIT_APPROVED(1, "审核中"),
        INVOICE(2, "已出票"),
        REFUSE_APPROVED(3, "未通过");

        private Integer code;
        private String desc;

        invoiceStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<invoiceStatus> op = Arrays.stream(invoiceStatus.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<invoiceStatus> op = Arrays.stream(invoiceStatus.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }


    /**
     * 订单类型 1 普通商品订单 2 商家批发订单 3 爆品绑定订单 4 直播间订单
     *          虚拟订单 0 是 1 否
     *          积分商品订单 0是 1否
     *          是否是门店自提订单 1是 2否
     *
     */
    enum orderType {
        GOODS_TYPE(1,"普通商品订单"),
        SUPPLY_TYPE(2,"商家批发订单"),
        HOT_GOODS_TYPE(3,"爆品绑定订单"),
        IS_VIRTUAL(0,"是虚拟订单"),
        NOT_VIRTUAL(1,"不是虚拟订单"),
        IS_INTEGRA(0,"是积分商品订单"),
        NOT_INTEGRA(1,"不是积分商品订单"),
        IS_SHOP_TAKE(1,"是门店自提订单"),
        NOT_SHOP_TAKE(2,"不是门店自提订单");

        private Integer code;
        private String desc;

        orderType(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<orderType> op = Arrays.stream(orderType.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<orderType> op = Arrays.stream(orderType.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 协议状态状态:ME_AGREEMENT -企业;US_AGREEMENT-个人;GEN_COR_AGREEMENT-入驻合同;GY_ME_AGREEMENT-供应商商家 GY_US_AGREEMENT-供应商用户
     */
    enum agreement {
        ME_AGREEMENT("ME_AGREEMENT","企业"),
        US_AGREEMENT("US_AGREEMENT","个人"),
        GEN_COR_AGREEMENT("GEN_COR_AGREEMENT","入驻合同"),
        GY_ME_AGREEMENT("GY_ME_AGREEMENT","供应商商家"),
        GY_US_AGREEMENT("GY_US_AGREEMENT","供应商用户"),
        BR_AGREEMENT("BR_AGREEMENT","通用");

        private String type;
        private String desc;

        agreement(String type, String desc) {
            this.type = type;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<agreement> op = Arrays.stream(agreement.values())
                    .filter(statusEnum -> statusEnum.getType().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static String getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<agreement> op = Arrays.stream(agreement.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getType();
            } else {
                return null;
            }
        }

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 支付配置
     */
    enum payStart {
        PAY_CONF_00("00", "微信 PC h5"),
        PAY_CONF_01("01", "app"),
        PAY_CONF_02("02", "微信小程序"),
        PAY_CONF_03("03", "支付宝");

        private String type;
        private String desc;

        payStart(String type, String desc) {
            this.type = type;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<payStart> op = Arrays.stream(payStart.values())
                    .filter(statusEnum -> statusEnum.getType().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static String getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<payStart> op = Arrays.stream(payStart.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getType();
            } else {
                return null;
            }
        }

        public String getType() {
            return type;
        }

        public void setType(String type) {
            this.type = type;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 直播商品审核状态1 通过 2 审核中 3 不通过  4待平台审核  5待微信审核
     */
    enum liveGoodsVerify {
        APPROVED(1, "通过"),
        AUDITING(2, "审核中"),
        AUDIT_ERROR(3, "不通过"),
        WAIT_AUDIT(4, "待平台审核"),
        WAIT_WX_AUDIT(5, "待微信审核");

        private Integer code;
        private String desc;

        liveGoodsVerify(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<liveGoodsVerify> op = Arrays.stream(liveGoodsVerify.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<liveGoodsVerify> op = Arrays.stream(liveGoodsVerify.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 微信相关接口
     */
    enum wxApiUrl {
        LIVE_GOODS_ADD(1, "https://api.weixin.qq.com/wxaapi/broadcast/goods/add?access_token="),
        LIVE_GOODS_DELETE(2, "https://api.weixin.qq.com/wxaapi/broadcast/goods/delete?access_token="),
        WX_UPLOAD_IMAGES(3, "https://api.weixin.qq.com/cgi-bin/media/upload?access_token=ACCESS_TOKEN&type=TYPE"),
        WX_GET_ROLE_LIST(4, "https://api.weixin.qq.com/wxaapi/broadcast/role/getrolelist?access_token=ACCESSTOKEN&keyword=KEYWORD&role=ROLE"),
        WX_LIVE_DEL_ROLE(5, "/wxaapi/broadcast/role/deleterole?access_token="),
        WX_LIVE_CREATE_ROOM(6, "/wxaapi/broadcast/room/create?access_token="),
        WX_LIVE_INFO(7, "/wxa/business/getliveinfo?access_token="),
        API_WECHAT_QQ_URL(99, "https://api.weixin.qq.com");

        private Integer code;
        private String desc;

        wxApiUrl(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<wxApiUrl> op = Arrays.stream(wxApiUrl.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<wxApiUrl> op = Arrays.stream(wxApiUrl.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 佣金订单状态
     */
    enum CommissionOrderStatus {
        UN_PAY(1, "待支付"),
        UN_SETTLE(2, "未入账"),
        SETTLED(3, "已入账"),
        RETURN(4, "已退款"),
        CANCEL(5, "已取消");


        private Integer code;
        private String desc;

        CommissionOrderStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<CommissionOrderStatus> op = Arrays.stream(CommissionOrderStatus.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<CommissionOrderStatus> op = Arrays.stream(CommissionOrderStatus.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 付款状态
     */

    enum recordStatus {
        TO_BE_PAID(1, "待支付"),
        PAID(2, "已付款"),
        TO_BE_SHIPPED(3, "待发货"),
        SHIPPED(4, "已发货"),
        SIGNED_FOR(5, "已签收"),
        CONFIRM_RECEIPT(6, "确认收货"),
        CANCEL(7, "取消"),
        REFUNDING(8, "退款中"),
        REFUNDED(9, "已退款"),
        PICKED_UP_BY_ONESELF(11, "待自提"),
        VIRTUAL_ORDER_HAS_EXPIRED(12, "虚拟订单已过期");


        recordStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private Integer code;
        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<recordStatus> op = Arrays.stream(recordStatus.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<recordStatus> op = Arrays.stream(recordStatus.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 拼团交易记录状态
     */
    enum recordStatus2 {
        WAITING_FOR_DISPOSE(1,"待处理"),
        DEAL_FINISHED(2,"完成"),
        DEAL_CANCEL(3,"取消"),
        WITHDRAW_CANCEL(4,"提现失败");


        recordStatus2(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private Integer code;
        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<recordStatus2> op = Arrays.stream(recordStatus2.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<recordStatus2> op = Arrays.stream(recordStatus2.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }



    /**
     * 审批状态
     */
    enum approvalStatus {
        UNDER_APPROVAL(0,"审批中"),
        APPROVAL_SUCCEEDED(1,"审批成功"),
        REJECTED(2,"已驳回"),
        TIMED_OUT(3,"已超时"),
        CANCELED(4,"已取消");


        private Integer code;

        approvalStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<approvalStatus> op = Arrays.stream(approvalStatus.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<approvalStatus> op = Arrays.stream(approvalStatus.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 退货状态
     */
    enum returnState {
        MERCHANT_REJECTION(0,"商家拒绝"),
        NEW_LAUNCH_PENDING_SELLER_REVIEW(1,"新发起等待卖家审核"),
        APPROVED_BY_THE_SELLER(2,"卖家审核通过"),
        SELLER_FAILED_THE_REVIEW(3,"卖家审核不通过"),
        SELLER_RECEIVES_GOODS(4,"卖家审核不通过"),
        PLATFORM_APPROVED(5,"平台审核通过"),
        BUYER_HAS_FILLED_IN_LOGISTICS(6,"买家已填物流"),
        PLATFORM_REJECTION(7,"平台拒绝"),
        REFUND_CLOSED(8,"退款关闭"),
        PLATFORM_INTERVENTION(9,"平台介入"),
        ACCEPTANCE_NOT_PASSED(10,"验收不通过"),
        TO_BE_RETURNED_BY_THE_BUYER(11,"待买家退货"),
        TO_BE_ACCEPTED(12,"待验收"),
        RETURN_CLOSED(13,"退货关闭");

        private Integer code;

        returnState(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<returnState> op = Arrays.stream(returnState.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<returnState> op = Arrays.stream(returnState.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 平台介入状态
     */
    enum interventionState {
        WAITING_FOR_SELLER(0,"待卖家上传凭证"),
        PENDING_PLATFORM_REVIEW(1,"待平台审核"),
        PROCESSED(2,"已处理"),
        BUYER_WITHDRAWAL(3,"买家撤销");

        private Integer code;

        interventionState(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<interventionState> op = Arrays.stream(interventionState.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<interventionState> op = Arrays.stream(interventionState.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }


    /**
     * 平台处理结果
     */
    enum processingResults {
        BUYER_VICTORY(0,"买家胜利"),
        SELLER_VICTORY(1,"卖家胜利"),
        USER_REVOCATION(2,"用户撤销");

        private Integer code;

        processingResults(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<processingResults> op = Arrays.stream(processingResults.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<processingResults> op = Arrays.stream(processingResults.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }


    /**
     * 常用审核状态 0-正常；1-待审核；2-审核不通过
     */
    enum commonUseAuditStatus {
        AUDIT_SUCCESS(0, "正常"),
        AUDIT_WAIT(1, "待审核"),
        AUDIT_FAILED(2, "审核不通过");


        private Integer code;
        private String desc;

        commonUseAuditStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<commonUseAuditStatus> op = Arrays.stream(commonUseAuditStatus.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<commonUseAuditStatus> op = Arrays.stream(commonUseAuditStatus.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 账单状态（0 待还款 1部分还款 2已还清 3已逾期）
     */
    enum accountStatus {
        WAIT_REPAYMENT(0, "待还款"),
        PART_REPAYMENT(1, "部分还款"),
        PAID_OFF(2, "已还清"),
        OVERDUE(3, "已逾期");


        private Integer code;
        private String desc;

        accountStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<accountStatus> op = Arrays.stream(accountStatus.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<accountStatus> op = Arrays.stream(accountStatus.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 账单消息
     */
    enum AccountMessage {
        COLLECTION_SUCCESS(0, "还款审核成功，结果：通过！"),
        COLLECTION_FAIL(1, "还款审核成功，结果：不通过！"),
        PAID_OFF(2, "已还清"),
        OVERDUE(3, "已逾期");


        private Integer code;
        private String desc;

        AccountMessage(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<AccountMessage> op = Arrays.stream(AccountMessage.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<AccountMessage> op = Arrays.stream(AccountMessage.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }


    /**
     * 是否授权账期 0，未授权 1，已授权 2，已冻结
     */
    enum IsAccount {
        UNAUTHORIZED(0, "未授权"),
        AUTHORIZED(1, "已授权"),
        FROZEN(2, "已冻结");

        private Integer code;
        private String desc;

        IsAccount(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<IsAccount> op = Arrays.stream(IsAccount.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<IsAccount> op = Arrays.stream(IsAccount.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 消息类型买家 1订单信息 3账户信息 4其他
     */
    enum messageType {
        ORDER_MESSAGE(1, "订单信息"),
        ACCOUNT_MESSAGE(3, "账户信息"),
        OTHER(4, "其他");


        private Integer code;
        private String desc;

        messageType(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<messageType> op = Arrays.stream(messageType.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<messageType> op = Arrays.stream(messageType.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 提现申请状态
     */
    enum isSucceed {
        AUDIT_WAIT(0, "待审核"),
        HAVE_IN_HAND(1, "进行中"),
        PAYMENT_COMPLETED(2, "打款完成"),
        PASS_THROUGH(3, "通过"),
        NO_PASS(4, "不通过");

        private Integer code;
        private String desc;

        isSucceed(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<isSucceed> op = Arrays.stream(isSucceed.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<isSucceed> op = Arrays.stream(isSucceed.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }
    /**
     * 移动端 首页装修
     *      页面状态(1  首页 2 专题页)
     *      页面数据活动状态（0 活动结束 1 活动正常）
     *      页面数据商品状体（1 上架 2 下架）
     *      页面发布状态 （0 未发布 1 以发布）
     *      页面使用状态 （0 未使用 1已使用）
     *      文件状态（1 图片  2 视频）
     */
    enum modularizationdState {

        INDEX(1, "首页"),
        NOT_INDEX(2, "专题页"),
        ACTIVITY_START(0, "活动结束"),
        ACTIVITY_END(1, "活动正常"),
        GOODS_SHELVES(1, "商品上架"),
        GOODS_TAKEDOWN(2, "商品下架"),
        PAGE_USE(1, "页面已使用"),
        PAGE_NOT_USE(0, "页面未使用"),
        PAGE_PUBLISH(1, "页面已发布"),
        PAGE_NOT_PUBLISH(0, "页面未发布"),
        FILE_IMAGE(1, "图片"),
        FILE_VIDEO(2, "视频");

        private Integer code;
        private String desc;

        modularizationdState(Integer code, String desc) {

            this.code = code;

            this.desc = desc;

        }

        public static String getByCode(Integer code) {

            if (code == null) {

                return null;

            }

            Optional<modularizationdState> op = Arrays.stream(modularizationdState.values())

                    .filter(statusEnum -> statusEnum.getCode().equals(code))

                    .findFirst();

            if (op.isPresent()) {

                return op.get().getDesc();

            } else {

                return null;

            }

        }

        public static Integer getByName(String name) {

            if (StringUtils.isEmpty(name)) {

                return null;

            }

            Optional<modularizationdState> op = Arrays.stream(modularizationdState.values())

                    .filter(statusEnum -> statusEnum.getDesc().equals(name))

                    .findFirst();

            if (op.isPresent()) {

                return op.get().getCode();

            } else {

                return null;

            }

        }

        public Integer getCode() {

            return code;

        }

        public void setCode(Integer code) {

            this.code = code;

        }

        public String getDesc() {

            return desc;

        }

        public void setDesc(String desc) {

            this.desc = desc;

        }

    }

    /**
     * 余额明细类型
     */
    enum detailType {
        DEFAULT(0, "默认"),
        BALANCE_RECHARGE(1, "余额充值"),
        ORDER_REFUND(2, "订单退款"),
        WITHDRAWAL_FAILED(3, "提现失败"),
        WITHDRAWAL_OF_BALANCE(4, "余额提现"),
        BALANCE_TRANSFER(5, "余额转账"),
        SHOPPING_CONSUMPTION(6, "购物消费"),
        SHOPPING_CARD_RECHARGE(7,"购物卡充值"),
        BALANCE_DEDUCTION(8, "余额扣款");

        private Integer code;
        private String desc;

        detailType(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<detailType> op = Arrays.stream(detailType.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<detailType> op = Arrays.stream(detailType.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 资产类型:1-收入；2-支出
     */
    enum assetType {
        INCOME(1, "收入"),
        EXPENDITURE(2, "支出");

        private Integer code;
        private String desc;

        assetType(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<assetType> op = Arrays.stream(assetType.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<assetType> op = Arrays.stream(assetType.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }
    /**
     * 转帐状态
     */
    enum transferStatus {
        PROCESSING(0, "处理中"),
        RECEIVED(1, "已收到"),
        EXCEED_THE_TIME(2, "过期");

        private Integer code;
        private String desc;

        transferStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<transferStatus> op = Arrays.stream(transferStatus.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<transferStatus> op = Arrays.stream(transferStatus.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 活动商品状态， 1-正常/2-结束/3-管理员关闭
     */
    enum activityGoodsState {
        NORMAL(1, "正常"),
        FINISH(2, "结束"),
        ADMIN_SHUT_DOWN(3, "管理员关闭");

        private Integer code;
        private String desc;

        activityGoodsState(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<activityGoodsState> op = Arrays.stream(activityGoodsState.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<activityGoodsState> op = Arrays.stream(activityGoodsState.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 用户状态
     */
    enum userState {
        NOT_ACTIVE(0, "未激活"),
        NOT_CERTIFIED(1, "未认证"),
        CERTIFIED(2, "已认证"),
        LOCK(3, "锁定"),
        MULTIPLE_ACCOUNTS(8, "多账号");

        private Integer code;
        private String desc;

        userState(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<userState> op = Arrays.stream(userState.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<userState> op = Arrays.stream(userState.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 账单最后状态 1未还款，2待审核，3审核失败，4已逾期，5已还清，6部分还款
     */
    enum finalStatus {
        UNPAID(1, "未还款"),
        REVIEWED(2, "待审核"),
        AUDIT_FAILED(3, "审核失败"),
        OVERDUE(4, "已逾期"),
        PAID_OFF(5,"已还清"),
        PARTIAL_REPAYMENT(6, "部分还款");

        private Integer code;
        private String desc;

        finalStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<finalStatus> op = Arrays.stream(finalStatus.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<finalStatus> op = Arrays.stream(finalStatus.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }


    /**
     * 回款审核状态 0 无状态/审核成功 1待审核 2审核失败
     */
    enum collectionStatus {
        STATELESS(0, "无状态/审核成功"),
        AUDIT_SUCCEEDED(1, "待审核"),
        REVIEWED(2, "审核失败");

        private Integer code;
        private String desc;

        collectionStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<collectionStatus> op = Arrays.stream(collectionStatus.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<collectionStatus> op = Arrays.stream(collectionStatus.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 级别
     */
    enum level {
        ONE(1, "one"),
        TWO(2, "two"),
        THREE(3, "three");

        private Integer code;
        private String desc;

        level(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<level> op = Arrays.stream(level.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<level> op = Arrays.stream(level.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 其他
     */
    enum other {
        MO_ID(0, "默认id 0"),
        MO_DISPLAY_ORDER(1, "默认排序"),
        RETURN_START_NO(0, "不存在退款退货"),
        RETURN_START_YES(1, "存在退款退货"),
        QUOTE_NUM(2, "报价最大次数"),
        NOT_USED(0, "未使用"),
        OTHER(99, "other");

        private Integer code;
        private String desc;

        other(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<other> op = Arrays.stream(other.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<other> op = Arrays.stream(other.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }
    /**
     * 运费 包邮（0不包邮 1全国包邮 2自定义）
     *      条件( 1 重量 2 件数)
     *      默认规则（0 否 1 是）
     */
    enum shippingStart {
        NOT_SHIPPING(0, "不包邮"),
        SHIPPING(1, "全国包邮"),
        CUSTOMIZATION_SHIPPING(2, "自定义"),
        WEIGHT(1, "重量"),
        ITEM(1, "件数"),
        DEFAULT_RULES(1,"是"),
        NOT_DEFAULT_RULES(0,"否");

        private Integer code;
        private String desc;

        shippingStart(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<shippingStart> op = Arrays.stream(shippingStart.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<shippingStart> op = Arrays.stream(shippingStart.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 商品分类状态 （0 无等级 1 一级分类 2 二级分类  3 三级分类）
     *      当前分类下是否允许分布虚拟商品 （0 是 不允许  1 是 允许）
     *
     */
    enum catStart {
        GRADE_ZERO(0, "无等级 或是顶级分类"),
        GRADE_ONE(1, "一级分类"),
        GRADE_TWO(2, "二级分类"),
        GRADE_THREE(3, "三级分类"),
        IS_VIRTUAL(1, "允许"),
        NOT_IS_VIRTUAL(0,"不允许");

        private Integer code;
        private String desc;

        catStart(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<catStart> op = Arrays.stream(catStart.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<catStart> op = Arrays.stream(catStart.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 询价单状态     0：待报价/暂未接到报价，1：部分报价，2：已报价, 5: 已有商品价格得询价
     */
    enum inquiryStuats {
        WAIT_QUOTED(0, "待报价/暂未接到报价"),
        PART_QUOTED(1, "部分报价"),
        QUOTED(2, "已报价"),
        HAVE_PRICE(5, "已有商品价格得询价");


        private Integer code;
        private String desc;

        inquiryStuats(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<inquiryStuats> op = Arrays.stream(inquiryStuats.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<inquiryStuats> op = Arrays.stream(inquiryStuats.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }
    /**
     * 商品类型     0 积分商品
     *              1 普通商品
     */
    enum goodsType {
        GOODS_TYPE_INTEGRAL(0, "积分商品"),
        GOODS_TYPE_ORDINARY(1, "普通商品");


        private Integer code;
        private String desc;

        goodsType(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<goodsType> op = Arrays.stream(goodsType.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<goodsType> op = Arrays.stream(goodsType.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }
    /**
     * 支付方式  1-余额支付，2-支付宝支付，3-微信支付， 6-购物卡支付，
     *          13-账期支付, 14-主管支付
     *
     *       1.线上支付  2.线下支付 3.货到付款 4.账期支付
     */
    enum payType {
        PAY_TYPE_BALANCE(1, "余额支付"),
        PAY_TYPE_ZFB(2, "支付宝支付"),
        PAY_TYPE_WX(3, "微信支付"),
        PAY_TYPE_SHOPPING_CARDS(6, "购物卡支付"),
        PAY_TYPE_BILLING_PERIOD(13, "账期支付"),
        GOODS_TYPE_SUPERVISOR(14, "主管支付"),
        ONLINE_PAY(1, "线上支付"),
        OFFLINE_PAY(2, "线下支付"),
        GOODS_ARRIVED_PAY(3, "货到付款"),
        BILLING_PERIO_PAY(4, "账期支付"),
        CARD_AND_ALIPAY_PAYMENT(7, "充值卡+支付宝"),
        CARD_AND_WECHAT_PAYMENT(8, "充值卡+微信"),
        ALI(1,"ALI"),
        WX(2,"WX");

        private Integer code;
        private String desc;

        payType(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<payType> op = Arrays.stream(payType.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<payType> op = Arrays.stream(payType.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 支付类型
     */
    enum payCode  {
        ALI(1,"支付宝"),
        WX(2,"微信");

        private Integer code;
        private String desc;

        payCode(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<payCode> op = Arrays.stream(payCode.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<payCode> op = Arrays.stream(payCode.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }



        /**
     * 企业用户状态 0企业注册 1升级企业 2变更主体
     *      1 企业审核通过 0  企业审核不通过
     *      0-待审核,1-审核通过,2-审核不通过
     *     部门级别 1为默认 2为次级
     * */
    enum businessType {
        OFFLINE_PAY(0, "企业注册"),
        GOODS_ARRIVED_PAY(1, "升级企业"),
        BILLING_PERIO_PAY(2, "变更主体"),
        IS_PASS(1, "企业审核通过"),
        not_Pass(0, "企业审核不通过"),
        TO_BE_REVIEWED(0, "待审核"),
        PASS_AUDIT(1, "审核通过"),
        FAIL_PASS_AUDIT(2, "审核不通过"),
        BUSINESS_REGISTRATION(1, "是企业注册"),
        NOT_BUSINESS_REGISTRATION(0, "不是企业注册"),
        DEPARTMENT_LEVEL_DEFAULT(1, "默认"),
        DEPARTMENT_LEVEL(2, "次级");


        private Integer code;
        private String desc;

        businessType(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<businessType> op = Arrays.stream(businessType.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<businessType> op = Arrays.stream(businessType.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 售后类型 1.退款 2.仅退款 3退货退款
     */
    enum returnMethodType {
        REFUND(1, "退款"),
        ONLY_REFUND(2, "仅退款"),
        RETURN(3, "退货退款");


        private Integer code;
        private String desc;

        returnMethodType(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<returnMethodType> op = Arrays.stream(returnMethodType.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<returnMethodType> op = Arrays.stream(returnMethodType.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 全部型号添加状态 1.只添加购物车 2.只添加询价篮 3.询价篮跟购物车
     */
    enum allModelStatus {
        ONLY_CART(1, "只添加购物车"),
        ONLY_BASKET(2, "只添加询价篮"),
        CART_AND_BASKET(3, "询价篮跟购物车");

        private Integer code;
        private String desc;

        allModelStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<allModelStatus> op = Arrays.stream(allModelStatus.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<allModelStatus> op = Arrays.stream(allModelStatus.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }
    /**
     * 供应商状态
     */
    enum supplierGoodsStatus {
        //商品操作类型
        PUTAWAY(1, "一键上架"),
        BUY(2, "立即购买"),
        APPLY(3, "申请经销商"),
        HAVA_GOODS(4, "已经销"),
        // 经销申请状态
        WAIT_AUTH(1,"待审核"),
        AUTH_PASS(2,"审核通过"),
        AUTH_REFUSE(3,"审核不通过"),
        DEALER_DEL(4,"已删除");



        private Integer code;
        private String desc;

        supplierGoodsStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<supplierGoodsStatus> op = Arrays.stream(supplierGoodsStatus.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<supplierGoodsStatus> op = Arrays.stream(supplierGoodsStatus.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }
    /**
     * 佣金订单状态
     */
    enum goodsShareType {
        VK_INVITE(1, "微客申请购买指定分销商品"),
        VK_COMMISSION(2, "微客分享购买获佣");



        private Integer code;
        private String desc;

        goodsShareType(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<goodsShareType> op = Arrays.stream(goodsShareType.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<goodsShareType> op = Arrays.stream(goodsShareType.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }
    /**
     * 用户邀请类型
     */
    enum inviteRecordType {
        VK_INVITE(1,"申请微客邀请"),
        SHARE_GOODS(2,"首次分享购买邀请");

        private Integer code;
        private String desc;

        inviteRecordType(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<inviteRecordType> op = Arrays.stream(inviteRecordType.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<inviteRecordType> op = Arrays.stream(inviteRecordType.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }
    /**
     * 店铺会员用户来源
     */
    enum vipUserSource {
        MALLS_INVITE(1,"商家邀请注册"),
        VK_INVITE(2,"微客邀请会员注册"),
        YG_INVITE(3,"员工邀请会员注册"),
        BUY_GOODS(4,"微客分享购买店铺商品"),
        SELF_BUY_GOODS(5,"自主购买店铺商品"),
        VK_APPLY_INVITE(6,"申请微客-邀请会员"),
        VK_APPLY_BUY(7,"申请微客-购买商品"),
        COMMON_INVITE(8,"普通会员邀请");



        private Integer code;
        private String desc;

        vipUserSource(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<vipUserSource> op = Arrays.stream(vipUserSource.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<vipUserSource> op = Arrays.stream(vipUserSource.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }
    /**
     * 微客申请条件
     */
    enum vKAddCondition{
        //类型
        RANDOM(1,"满足任一勾选条件"),
        ALL(2,"同时满足所有条件"),
        //条件
        BUY_GOODS(1,"购买指定商品"),
        INVITE_USER(2,"邀请会员"),
        BUY_INVITE(3,"购买+邀请(如果条件是满足任一条件 则两者满足一样即可)");

        private Integer code;
        private String desc;

        vKAddCondition(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<vKAddCondition> op = Arrays.stream(vKAddCondition.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<vKAddCondition> op = Arrays.stream(vKAddCondition.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }
    /**
     * 微客用户状态
     */
    enum vKStatus {
        PASS(1,"通过"),
        REJECT(2,"拒绝"),
        AUTH(3,"待审核"),
        DELETE(4,"已删除"),;




        private Integer code;
        private String desc;

        vKStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<vKStatus> op = Arrays.stream(vKStatus.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<vKStatus> op = Arrays.stream(vKStatus.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }
    /**
     * 微客用户状态
     */
    enum vKAddType {
        MALL_INVITE("1","商家邀请"),
        MALL_ADD("2","商家自己添加"),
        VK_INVITE("3","微客邀请");




        private String code;
        private String desc;

        vKAddType(String code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(String code) {
            if (code == null) {
                return null;
            }
            Optional<vKAddType> op = Arrays.stream(vKAddType.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static String getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<vKAddType> op = Arrays.stream(vKAddType.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public String getCode() {
            return code;
        }

        public void setCode(String code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }
    /**
     * 是否经销商品  0 普通商品   1 经销商品(商家一键上架供应商商品)  2购买经销商品（商家通过立即购买供应商上架的商品）
     */
    enum dealerGoodsFlag {
        MALL_INVITE(0,"普通商品"),
        MALL_ADD(1,"经销商品(商家一键上架供应商商品"),
        VK_INVITE(2,"购买经销商品（商家通过立即购买供应商上架的商品）");




        private Integer code;
        private String desc;

        dealerGoodsFlag(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<dealerGoodsFlag> op = Arrays.stream(dealerGoodsFlag.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<dealerGoodsFlag> op = Arrays.stream(dealerGoodsFlag.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 是否存在退货退款 1存在  0 不存在
     */
    enum isReteun {
        RETURN_NO(0, "不存在"),
        RETURN_YES(1, "存在");


        private Integer code;
        private String desc;

        isReteun(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<isReteun> op = Arrays.stream(isReteun.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<isReteun> op = Arrays.stream(isReteun.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }
    /**
     * plus 会员 年卡 季卡 月卡
     */
    enum plusThaliType {
        PLUS_THALI_MOON(1, "月卡"),
        PLUS_THALI_SEASON(2, "季卡"),
        PLUS_THALI_YEAR(3, "年卡"),
        PLUS_CONTENT1(4,"尊敬的用户，您的PLUS"),
        PLUS_CONTENT2(4,"权益-红包券已到账，请查收！"),
        PLUS_CONTENT3(5,"红包到账通知");

        private Integer code;
        private String desc;

        plusThaliType(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<plusThaliType> op = Arrays.stream(plusThaliType.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<plusThaliType> op = Arrays.stream(plusThaliType.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }
    /**
     * plus 会员 1 PLUS专属折扣, 2 无门槛红包,3 红包券,4 送积分,5 积分倍率
     */
    enum plusEquityType {
        PLUS_EXCLUSIVE(1, "PLUS专属折扣"),
        PLUS_NO_THRESHOLD_REDPAPER(2, "无门槛红包"),
        PLUS_RED_PAPER(3, "红包券"),
        PLUS_INTEGRAL (4, "送积分"),
        PLUS_INTEGRAL_MAGNIFICATION(5, "积分倍率");


        private Integer code;
        private String desc;

        plusEquityType(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<plusEquityType> op = Arrays.stream(plusEquityType.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<plusEquityType> op = Arrays.stream(plusEquityType.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 通用状态
     */
    enum afterSalesMethods {
        NO_AFTER_SALES(1, "未参加过售后"),
        ONLY_REFUND(2, "参加过仅退款售后"),
        REFUND(3, "参加过退货售后"),
        RETURN(4, "参加过退款售后");


        private Integer code;
        private String desc;

        afterSalesMethods(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<afterSalesMethods> op = Arrays.stream(afterSalesMethods.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<afterSalesMethods> op = Arrays.stream(afterSalesMethods.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }


    /**
     * 通用状态
     */
    enum goodsOperateType {
        PUTAWAY(1,"一键上架"),
        BUY(2,"立即购买"),
        APPLY(3,"申请经销商"),
        HAVA_GOODS(4,"已经销"),;


        private Integer code;
        private String desc;

        goodsOperateType(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<goodsOperateType> op = Arrays.stream(goodsOperateType.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<goodsOperateType> op = Arrays.stream(goodsOperateType.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }
    /**
     * 通用状态
     */
    enum PromotionReceiveOrNot {
        NO_RECEIVE(0, "未领取"),
        IMMEDIATELY(1, "立即使用"),
        NEW_VIP(2, "新人专享"),
        ALREADY_USE(3, "已使用"),
        EXPIRE(4, "已过期"),
        RECOVERY(5, "回收"),
        BOOKING(6, "还未开始，倒计时"),
        NO_NUM_GET(7, "已抢光");


        private Integer code;
        private String desc;

        PromotionReceiveOrNot(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<PromotionReceiveOrNot> op = Arrays.stream(PromotionReceiveOrNot.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<PromotionReceiveOrNot> op = Arrays.stream(PromotionReceiveOrNot.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * oss类型 1.阿里云 2.minio
     */
    enum ossType {
        ALIYUN(1, "aliyun"),
        MINIO(2, "minio");


        private Integer code;
        private String desc;

        ossType(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<ossType> op = Arrays.stream(ossType.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<ossType> op = Arrays.stream(ossType.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    enum TreasureStatus {

        NO_PAY(1, "尚未缴纳"),
        ALREADY_PAY(2, "已缴纳"),
        VERIFING(3, "审核中"),
        VERIFY_FAIL(4, "审核失败");

        private Integer code;
        private String desc;

        TreasureStatus(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<TreasureStatus> op = Arrays.stream(TreasureStatus.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<TreasureStatus> op = Arrays.stream(TreasureStatus.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
        }

    /**
     * 核销状态
     */
    enum isCancel {
        NO(0, "订单已核销"),
        YES(1, "订单未核销"),
        EXPIRE(2, "订单过期");



        private Integer code;

        isCancel(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<isCancel> op = Arrays.stream(isCancel.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<isCancel> op = Arrays.stream(isCancel.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 微客申请条件
     */
    enum VKSetType {
        BUY_GOODS(1,"购买指定商品"),
        INVITE_USER(2,"邀请会员"),
        BUY_INVITE(3,"购买+邀请(如果条件是满足任一条件 则两者满足一样即可)");

        private Integer code;

        VKSetType(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<VKSetType> op = Arrays.stream(VKSetType.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<VKSetType> op = Arrays.stream(VKSetType.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 支付单来源
     */
    enum payPlatFrom {
        PC(1,"pc"),
        WAP(2,"wap微信浏览器"),
        ANDROID(3,"安卓"),
        IOS(5,"IOS"),
        MINI_PROGRAM(6,"微信小程序"),
        WAP_BROWSER(7,"wap浏览器");


        private Integer code;

        payPlatFrom(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<payPlatFrom> op = Arrays.stream(payPlatFrom.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<payPlatFrom> op = Arrays.stream(payPlatFrom.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }

    /**
     * 支付请求来源
     */
    enum  PayRequestFrom{
        PC(1,"PC"),
        APP(2,"APP"),
        HFIVE(3,"h5"),
        MINI_PROGRAM(4,"微信小程序"),
        WX_BROWSER(5,"微信浏览器"),
        WAP(6,"wap(h5,小程序，微信浏览器统称)");


        private Integer code;

        PayRequestFrom(Integer code, String desc) {
            this.code = code;
            this.desc = desc;
        }

        private String desc;

        public static String getByCode(Integer code) {
            if (code == null) {
                return null;
            }
            Optional<PayRequestFrom> op = Arrays.stream(PayRequestFrom.values())
                    .filter(statusEnum -> statusEnum.getCode().equals(code))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getDesc();
            } else {
                return null;
            }
        }

        public static Integer getByName(String name) {
            if (StringUtils.isEmpty(name)) {
                return null;
            }
            Optional<PayRequestFrom> op = Arrays.stream(PayRequestFrom.values())
                    .filter(statusEnum -> statusEnum.getDesc().equals(name))
                    .findFirst();
            if (op.isPresent()) {
                return op.get().getCode();
            } else {
                return null;
            }
        }

        public Integer getCode() {
            return code;
        }

        public void setCode(Integer code) {
            this.code = code;
        }

        public String getDesc() {
            return desc;
        }

        public void setDesc(String desc) {
            this.desc = desc;
        }
    }
}
